﻿using System;
using System.Collections;
using mojoPortal.Web.Framework;

namespace ud_Article.UI
{
    public class ArticleMenuConfiguration
    {
        public ArticleMenuConfiguration() { }

        public ArticleMenuConfiguration(Hashtable settings)
        {
            LoadSettings(settings);
        }

        private void LoadSettings(Hashtable settings)
        {
            if (settings == null) { throw new ArgumentException("must pass in a hashtable of settings"); }

            if (settings.Contains("CustomCssClassSetting"))
            {
                instanceCssClass = settings["CustomCssClassSetting"].ToString();
            }

            showHeaderSetting = WebUtils.ParseBoolFromHashtable(settings, "ShowHeaderSetting", showHeaderSetting);

            useArtisteerSetting = WebUtils.ParseBoolFromHashtable(settings, "UseArtisteerSetting", useArtisteerSetting);

            useAccordionSetting = WebUtils.ParseBoolFromHashtable(settings, "UseAccordionSetting", useAccordionSetting);

            accordionMouseHoverSetting = WebUtils.ParseBoolFromHashtable(settings, "AccordionMouseHoverSetting", accordionMouseHoverSetting);

            if (settings.Contains("ArticleModuleSelectorSetting"))
            {
                articleModuleSelectorSetting = settings["ArticleModuleSelectorSetting"].ToString();
            }

            maxNumberOfCharactersInTitleSetting = WebUtils.ParseInt32FromHashtable(settings, "MaxNumberOfCharactersInTitleSetting", maxNumberOfCharactersInTitleSetting);

            if (settings.Contains("TitleSuffixSetting"))
            {
                titleSuffixSetting = settings["TitleSuffixSetting"].ToString();
            }

            useTooltipSettings = WebUtils.ParseBoolFromHashtable(settings, "UseTooltipSettings", useTooltipSettings);

            if (settings.Contains("UseTooltipCssSettings"))
            {
                useTooltipCssSettings = settings["UseTooltipCssSettings"].ToString();
            }

            tooltipMaxCharSettings = WebUtils.ParseInt32FromHashtable(settings, "TooltipMaxCharSettings", tooltipMaxCharSettings);

            if (settings.Contains("TooltipEffectSettings"))
            {
                tooltipEffectSettings = settings["TooltipEffectSettings"].ToString();
            }

            tooltipDelaySettings = WebUtils.ParseInt32FromHashtable(settings, "TooltipDelaySettings", tooltipDelaySettings);

            contentPanelSetting = WebUtils.ParseInt32FromHashtable(settings, "ContentPanelSetting", contentPanelSetting);

            showBottomPanelSetting = WebUtils.ParseBoolFromHashtable(settings, "ShowBottomPanelSetting", showBottomPanelSetting);

            showTopPanelSetting = WebUtils.ParseBoolFromHashtable(settings, "ShowTopPanelSetting", showTopPanelSetting);

            showLeftPanelSetting = WebUtils.ParseBoolFromHashtable(settings, "ShowLeftPanelSetting", showLeftPanelSetting);

            showRightPanelSetting = WebUtils.ParseBoolFromHashtable(settings, "ShowRightPanelSetting", showRightPanelSetting);

            useTreeViewSetting = WebUtils.ParseBoolFromHashtable(settings, "UseTreeViewSetting", useTreeViewSetting);
        }

        private string instanceCssClass = string.Empty;
        public string InstanceCssClass
        {
            get { return instanceCssClass; }
        }

        private bool useArtisteerSetting;
        public bool UseArtisteerSetting
        {
            get { return useArtisteerSetting; }
        }

        private string articleModuleSelectorSetting = string.Empty;
        public string ArticleModuleSelectorSetting
        {
            get { return articleModuleSelectorSetting; }
        }

        private bool useAccordionSetting;
        public bool UseAccordionSetting
        {
            get { return useAccordionSetting; }
        }

        private bool accordionMouseHoverSetting;
        public bool AccordionMouseHoverSetting
        {
            get { return accordionMouseHoverSetting; }
        }

        private int maxNumberOfCharactersInTitleSetting = 100;
        public int MaxNumberOfCharactersInTitleSetting
        {
            get { return maxNumberOfCharactersInTitleSetting; }
        }

        private string titleSuffixSetting = "...";
        public string TitleSuffixSetting
        {
            get { return titleSuffixSetting; }
        }

        private bool useTooltipSettings;
        public bool UseTooltipSettings
        {
            get { return useTooltipSettings; }
        }

        private string useTooltipCssSettings = "tooltip";
        public string UseTooltipCssSettings
        {
            get { return useTooltipCssSettings; }
        }

        private int tooltipMaxCharSettings = 250;
        public int TooltipMaxCharSettings
        {
            get { return tooltipMaxCharSettings; }
        }

        private string tooltipEffectSettings = "slide";
        public string TooltipEffectSettings
        {
            get { return tooltipEffectSettings; }
        }

        private int tooltipDelaySettings;
        public int TooltipDelaySettings
        {
            get { return tooltipDelaySettings; }
        }

        private int contentPanelSetting;
        public int ContentPanelSetting
        {
            get { return contentPanelSetting; }
        }

        private bool showBottomPanelSetting = true;
        public bool ShowBottomPanelSetting
        {
            get { return showBottomPanelSetting; }
        }

        private bool showTopPanelSetting = true;
        public bool ShowTopPanelSetting
        {
            get { return showTopPanelSetting; }
        }

        private bool showLeftPanelSetting = true;
        public bool ShowLeftPanelSetting
        {
            get { return showLeftPanelSetting; }
        }

        private bool showRightPanelSetting = true;
        public bool ShowRightPanelSetting
        {
            get { return showRightPanelSetting; }
        }

        private bool useTreeViewSetting;
        public bool UseTreeViewSetting
        {
            get { return useTreeViewSetting; }
        }

        private bool showHeaderSetting;
        public bool ShowHeaderSetting
        {
            get { return showHeaderSetting; }
        }

    }
}